﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BungieNode
{
    public class NodeEnumerator : IEnumerator<Node>
    {
        private Node _listHead;

        public NodeEnumerator(Node listHead)
        {
            _listHead = listHead;
        }

        public void Dispose()
        {
            _listHead = null;
        }

        public bool MoveNext()
        {
            Current = Current == null ? _listHead : Current.Next;
            return Current != null;
        }

        public void Reset()
        {
            Current = null;
        }

        public Node Current { get; private set; }

        object IEnumerator.Current
        {
            get { return Current; }
        }
    }
}
